package com.yixun.qfbao.hander;

import com.yixun.qfbao.api.service.AreaService;
import com.yixun.qfbao.api.service.CommissionService;
import com.yixun.qfbao.apidto.GetCityReqDto;
import com.yixun.qfbao.apidto.GetCityResDto;
import com.yixun.qfbao.apidto.GetCommissionSetPageReqDto;
import com.yixun.qfbao.apidto.GetCommissionSetPageResDto;
import com.yixun.qfbao.dto.base.BaseRequestDTO;
import com.yixun.qfbao.dto.base.BaseResponseDTO;
import com.yixun.qfbao.hander.base.CommonAbstractHander;
import com.yixun.qfbao.vo.GetCityReqVo;
import com.yixun.qfbao.vo.GetCommissionSetPageReqVo;
import com.yixun.qfbao.xf.model.enums.ResultEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description
 * @Date 2017/12/4
 * @Author sangtao
 * @Computer Administrator
 */
@Service("getCommissionSetPageHander")
public class GetCommissionSetPageHander extends CommonAbstractHander {
    private static Logger logger= LoggerFactory.getLogger(GetCommissionSetPageHander.class);
    @Autowired
    private CommissionService commissionService;
    /**
    *@description
    *@author sangtao
    *@date 2017/12/4
    *@param reqDto
    **/
    @Override
    public BaseResponseDTO doBusiness(BaseRequestDTO reqDto) {
        BaseResponseDTO<GetCommissionSetPageResDto> res = new BaseResponseDTO<>();
        GetCommissionSetPageReqVo reqVo = (GetCommissionSetPageReqVo)reqDto;
        GetCommissionSetPageReqDto getCityReqDto = reqVo.getParams();
        try {
            GetCommissionSetPageResDto resDto = commissionService.getCommissionSetPage(getCityReqDto);
            res.setResult(resDto.getResult());
            res.setResData(resDto);
        } catch (Exception e) {
            logger.error("GetCommissionSetPageHander error: {}", e);
            res.setResult(ResultEnum.FAIL.getNo());
            res.setErrorMsg("获取佣金退则列表失败");
        }
        return res;
    }
}
